]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
appDisplay: Reload folder views on installed app changes
authorJonas Dreßler <verdre@v0yd.nl>
Mon, 17 Feb 2020 15:21:58 +0000 (16:21 +0100)
committerFlorian Müllner <florian.muellner@gmail.com>
Sun, 8 Mar 2020 00:42:40 +0000 (00:42 +0000)
Since the FolderViews are not connected to the "installed-changed"
signal, we need to reload their apps by calling _redisplay() when an app
is removed or installed. We can't connect to "installed-changed" inside
FolderView because we need to ensure _redisplay() of the FolderView is
called before AppView tries to access the apps of the folder inside
_refilterApps(). So reload the FolderViews inside AllViews _redisplay()
implementation to ensure everything is up to date before accessing the
apps of the folder.

Since the "apps-changed" signal of FolderIcon now indirectly triggers a
_redisplay() of the FolderViews, the 'changed' handler of FolderView is
now redundant and can be removed. Because of this, we also need to move
the emission of the "apps-changed" signal to the start of the signal
handler to make sure the view is updated before we try to access items
of the view.

Fixes https://gitlab.gnome.org/GNOME/gnome-shell/issues/1901

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/1011

js/ui/appDisplay.js

index 3d0bea97b3c000a5886ba6645498d029e598daf2..cdd1756c2cec6df004403f25fbf3c043b578c732 100644 (file)
@@ -431,6 +431,10 @@ var AllView = GObject.registerClass({
 
     _redisplay() {
         super._redisplay();
+
+        this._folderIcons.forEach(icon => {
+            icon.view._redisplay();
+        });
         this._refilterApps();
     }
 
@@ -1324,20 +1328,9 @@ class FolderView extends BaseAppView {
         action.connect('pan', this._onPan.bind(this));
         this._scrollView.add_action(action);
 
-        this.connect('destroy', this._onDestroy.bind(this));
-
-        this._folderChangedId = this._folder.connect(
-            'changed', this._redisplay.bind(this));
         this._redisplay();
     }
 
-    _onDestroy() {
-        if (this._folderChangedId) {
-            this._folder.disconnect(this._folderChangedId);
-            delete this._folderChangedId;
-        }
-    }
-
     _childFocused(actor) {
         Util.ensureActorVisibleInScrollView(this._scrollView, actor);
     }
@@ -1630,10 +1623,10 @@ var FolderIcon = GObject.registerClass({
     }
 
     _sync() {
+        this.emit('apps-changed');
         this._updateName();
         this.visible = this.view.getAllItems().length > 0;
         this.icon.update();
-        this.emit('apps-changed');
     }
 
     _createIcon(iconSize) {